import java.util.ArrayList;
import java.util.List;

public class Room {
	String roomID, roomName, description;
	boolean indoors, intown;
	// law - guards can be called    safe - combat cannot occur (bartender breaks it up?)
	boolean law,safe;
	
	// Is this room immune to default reset (say a player owned room)
	boolean reset;
	
	// Always lit, lit during day, always dark, city lights, etc
	String dark;
	
	public List<Exit> roomExits = new ArrayList<Exit>();
	
	//public Trap trap;
	//Mobs
	//Items
	
	public Room(String ID, String name, String desc, Exit northExit, Exit southExit, Exit eastExit, Exit westExit, Exit upExit, Exit downExit){
		roomID = ID;
		roomName = name;
		description = desc;
		
		if(northExit != null)
			roomExits.add(northExit);
		if(southExit != null)
			roomExits.add(southExit);
		if(eastExit != null)
			roomExits.add(eastExit);
		if(westExit != null)
			roomExits.add(westExit);
		if(upExit != null)
			roomExits.add(upExit);
		if(downExit != null)
			roomExits.add(downExit);
	}
	
	public void populateRoom(){
		
	}
	
	public Exit getExit(char exitChar){
		Exit exit = null;
		
		for(int i=0;i<roomExits.size();i++){
			if(roomExits.get(i).direction == exitChar){
				exit = roomExits.get(i);
			}
		}
		
		return exit;
	}
	
	public String toString(){
		return descRoom() + "\n\n  (Exits:" + exitList() + ")";
	}
	
	public String exitList(){
		String exitList = "";
		
		for(int i=0;i<roomExits.size();i++){
			if(i!= (roomExits.size()-1))
				exitList = exitList + roomExits.get(i).direction + ",";
			else
				exitList = exitList + roomExits.get(i).direction;
		}
		
		return exitList;
	}
	

	public String descRoom(){
		String roomDescription = roomName + "\n  " + description + "\n\nAreaID:[" + roomID + "] ";
		roomDescription = roomDescription;
	
		return roomDescription;
		
		/**
		if(!dark || player.haslight)
			DescribeRoom
			if(!containers.isEmpty)
				Show Containers
			if(!items.isEmpty)	
				Show Items
			if(!mobs.isEmpty)
				Show mobs
	
		return roomDescription;
		*/
	}	

}
